package com.tender;

import com.tender.utils.ESOperationTemplate;
import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.client.RequestOptions;

public class A_7_DeleteDoc {

    public static void main(String[] args) throws Exception {
        ESOperationTemplate.process(client -> {

            try {
                //创建请求对象
                DeleteRequest request = new DeleteRequest().index("user").id("1001");
                //客户端发送请求，获取响应对象
                DeleteResponse response = client.delete(request, RequestOptions.DEFAULT);
                //打印信息
                System.out.println(response.toString());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            return null;
        });
    }
}
